﻿@model DLMemberPointMS.Entity.ViewModel.MemCardSEditViewModel
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>会员转账</title>
    <link rel="stylesheet" type="text/css" href="~/layui/css/layui.css" />
    <script src="~/layui/layui.js" type="text/javascript" charset="utf-8"></script>
    <script src="~/layui/jquery-3.4.1.js" type="text/javascript" charset="utf-8"></script>
    <style>
        .layui-form-label {
            text-align: left;
            padding: 5px 10px;
            margin-top: 5px;
        }
    </style>
</head>

<body style="margin:5px">
    <form action="/" method="post" class="layui-form">
        <fieldset class="layui-elem-field">
            <legend>转出会员</legend>
            <div class="layui-field-box" style="border:5px">
                <div class="layui-input-inline">
                    <label class="layui-form-label">会员卡号：</label>
                    <div class="layui-input-block">
                        <label id="outid" class="layui-form-label"> @Html.DisplayFor(model => model.MC_CardID, new { htmlAttributes = new { disabled = "", @class = "layui-input layui-disabled", lay_verify = "required" } })</label>
                    </div>
                </div>
                <div class="layui-input-inline">
                    <label class="layui-form-label">会员姓名：</label>
                    <div class="layui-input-block">
                        <label class="layui-form-label"> @Html.DisplayFor(model => model.MC_Name, new { htmlAttributes = new { disabled = "", @class = "layui-input layui-disabled", lay_verify = "required" } })</label>

                    </div>
                </div><br />
                <div class="layui-input-inline">
                    <label class="layui-form-label">账户积分：</label>
                    <div class="layui-input-block">
                        <label class="layui-form-label"> @Html.DisplayFor(model => model.MC_Point, new { htmlAttributes = new { disabled = "", @class = "layui-input layui-disabled", lay_verify = "required" } })</label>

                    </div>
                </div>
                <div class="layui-input-inline">
                    <label class="layui-form-label">累计消费：</label>
                    <div class="layui-input-block">
                        <label class="layui-form-label"> @Html.DisplayFor(model => model.MC_TotalMoney, new { htmlAttributes = new { disabled = "", @class = "layui-input layui-disabled", lay_verify = "required" } })</label>

                    </div>
                </div>
                <div class="layui-input-inline">
                    <label class="layui-form-label">账户余额：</label>
                    <div class="layui-input-block">
                        <label class="layui-form-label"> @Html.DisplayFor(model => model.MC_Money, new { htmlAttributes = new { disabled = "", @class = "layui-input layui-disabled", lay_verify = "required" } })</label>

                    </div>
                </div>
            </div>
        </fieldset>
        <fieldset class="layui-elem-field">
            <legend>转入会员</legend>
            <div class="layui-field-box" style="border:5px">
                <div class="layui-input-inline">
                    <label class="layui-form-label">会员卡号：</label>
                    <div class="layui-input-block">
                        <input type="text" name="inid" class="layui-input" id="inid" lay-verify="required" lay-reqText="请先选择转入会员" />
                    </div>
                </div>
                <div class="layui-input-inline">
                    <input type="button" name="find" class="layui-btn " value="查找" id="searh" />
                </div>
                <div></div>
                <div class="layui-input-inline">
                    <label class="layui-form-label">会员卡号：</label>
                    <div class="layui-input-block">
                        <label class="layui-form-label" id="cardId"></label>
                    </div>
                </div>
                <div class="layui-input-inline">
                    <label class="layui-form-label">会员姓名：</label>
                    <div class="layui-input-block">
                        <label class="layui-form-label" id="name"></label>
                    </div>
                </div><br />
                <div class="layui-input-inline">
                    <label class="layui-form-label">账户积分：</label>
                    <div class="layui-input-block">
                        <label class="layui-form-label" id="point"></label>
                    </div>
                </div>
                <div class="layui-input-inline">
                    <label class="layui-form-label">累计消费：</label>
                    <div class="layui-input-block">
                        <label class="layui-form-label" id="money"></label>
                    </div>
                </div>
                <div class="layui-input-inline">
                    <label class="layui-form-label">账户余额：</label>
                    <div class="layui-input-block">
                        <label class="layui-form-label" id="MCmoney"></label>
                    </div>
                </div>
            </div>
        </fieldset>
        <br />
        <br />

        <div class="layui-input-inline">
            <label class="layui-form-label">转账金额：</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" id="tranmoney" />
            </div>
        </div>
        <br /><br />

        <div class="layui-input-inline">
            <label class="layui-form-label">操作备注：</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" id="remark" />
            </div>
        </div>
        <br />
        <br />
        <div class="layui-input-inline">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                <input type="button" name="tel" class="layui-btn " id="Trans" value="转账" />
            </div>
        </div>
    </form>



    <script>
        layui.use(['form', 'layer', 'laytpl'], function () {
            var form = layui.form,
                layer = layui.layer,
                laytpl = layui.laytpl;

            $('#searh').click(function () {
                var inid = $('#inid').val();
                $.ajax({
                    url: '/Member/MemTransferResult',
                    type: 'post',
                    data: { "id": inid },
                    success: function (data) {
                        if (data.code == 0) {
                            var MC_CardID = laytpl('{{ d.MC_CardID }}').render({
                                MC_CardID: data.data.MC_CardID
                            });
                            $('#cardId').text(MC_CardID)
                            var MC_Name = laytpl('{{ d.MC_Name }}').render({
                                MC_Name: data.data.MC_Name
                            });
                            $('#name').text(MC_Name)
                            var MC_Point = laytpl('{{ d.MC_Point }}').render({
                                MC_Point: data.data.MC_Point
                            });
                            $('#point').text(MC_Point)
                            var MC_TotalMoney = laytpl('{{ d.MC_TotalMoney }}').render({
                                MC_TotalMoney: data.data.MC_TotalMoney
                            });
                            $('#money').text(MC_TotalMoney)
                            var MC_Money = laytpl('{{ d.MC_Money }}').render({
                                MC_Money: data.data.MC_Money
                            });
                            $('#MCmoney').text(MC_Money)
                            //parent.layer.msg('ok', { icon: 1 });
                        } else {
                            parent.layer.msg(data.msg, { icon: 5 });
                        }
                    },
                    error: function (data) {
                        parent.layer.msg('出错了，请重试', { icon: 2 });
                    }
                })
            })
             var index = parent.layer.getFrameIndex(window.name); //得到当前iframe层的索引
            $('#Trans').click(function () {
                var outid = $('#outid').text().trim();
                var inid = $('#inid').val();
                var tranmoney = $('#tranmoney').val();
                var remark = $('#remark').val();
                $.ajax({
                    url: '/Member/StartTransfer',
                    type: 'post',
                    data: { "inID": inid, "outID": outid, "tranmoney": tranmoney, "remark": remark },
                    success: function (data) {
                        if (data.code == 0) {
                            parent.layer.msg(data.msg, { icon: 1 })
                            parent.layer.close(index); //再执行关闭
                        } else {
                            parent.layer.msg(data.msg, { icon: 2 })
                            parent.layer.close(index); //再执行关闭

                        }

                    },
                    error: function (data) {
                        parent.layer.msg('出错了，请重试', { icon: 2 })
                        parent.layer.close(index); //再执行关闭
                    }
                })
            })
        })
    </script>
</body>
</html>
